var character;
character = ds_list_find_value(global.team,global.team_member_current);

if (global.control == 1) && (instance_exists(character) == true) && (global.team_member_current != -1)
{
    switch (warp_type)
    {
        case 0:
        //Warp x
        warp_collision = collision_line(x,limit[0],x,limit[1],character,true,true);
        if (warp_collision > 0) && (((character.x < x) && (sign(character.character_hsp) == -1) && (x < (room_width/2))) || ((character.x > x) && (sign(character.character_hsp) == 1) && (x > (room_width/2))))
        {
            global.scn_next = warp_scn;
            global.warp_last[0] = warp_id;
            global.warp_last[1] = warp_type;
            character.character_warping = true;
        }
        break;
        
        case 1:
        //Warp y
        warp_collision = collision_line(limit[0],y,limit[1],y,character,true,true);
        if (warp_collision > 0) && (((sign(character.actor_vsp) == -1) && (y < (room_height/2))) or ((sign(character.actor_vsp) == 1) && (y > (room_height/2))))
        {
            global.scn_next = warp_scn;
            global.warp_last[0] = warp_id;
            global.warp_last[1] = warp_type;
            character.character_warping = true;
        }
        break;
        
        case 2:
        //Warp portal
        warp_collision = collision_rectangle(x-16,y-16,x+16,y+16,character,true,true);
        if ((warp_collision) > 0) && ((character.character_hsp == 0) && (character.character_vsp == 0) && keyboard_check_pressed(global.dpad[0]))
        {
            global.scn_next = warp_scn;
            global.warp_last[0] = warp_id;
            global.warp_last[1] = warp_type;
            character.character_warping = true;
        }
        break;
    }
}
